/**
 * 渠道发布
 */
import React from 'react';
import { history } from 'umi'
import AuthComponent from '@/utils/auth/AuthComponent';
import { eventTrack } from '@/utils/track';

import { Icon } from '../components';

function DemandPublish(props) {
    const { data = {} } = props;
    const handleClick = () => {
        eventTrack({
            eventName: 'personnel_management_recruitment_demand_list_detail_channel_publish_click',
            pageName: 'personnel_management_recruitment',
            eventProps: {
                click_context: data.dutyName
            }
        });
        history.push(`/office/personnelManagement/recruitment/channel?recruitCode=${data?.recruitCode}`);
    };
    // 跳转渠道列表页
    return (
        <AuthComponent code="office:recruitment:channel">
            <Icon title="渠道发布" type="qudaofabu" onClick={handleClick} {...props} />
        </AuthComponent>
    );
}

export default DemandPublish;
